<template>
  <div class="dashboard-editor-container">
    <panel-group
      :studentNumber="panelGroup.student"
      :teacherNumber="panelGroup.teacher"
      :courseNumber="panelGroup.course"
      :selectedNumber="panelGroup.selected"
    />

    <el-row style="background: #fff; padding: 16px 16px 0; margin-bottom: 32px">
      <line-chart :chart-data="lineChartData" />
    </el-row>
  </div>
</template>

<script>
import PanelGroup from "./dashboard/PanelGroup";
import LineChart from "./dashboard/LineChart";

import { countCourse, countPanelGroup } from "@/api/system/count";

export default {
  name: "Index",
  components: {
    PanelGroup,
    LineChart,
  },
  data() {
    return {
      lineChartData: [],
      panelGroup: {},
    };
  },
  created() {
    this.getCountCourse();
    this.getCountPanelGroup();
  },
  methods: {
    getCountCourse() {
      countCourse().then((res) => {
        this.lineChartData = res.data;
      });
    },
    getCountPanelGroup() {
      countPanelGroup().then((res) => {
        this.panelGroup = res.data;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
